<template>
	<view class="cmdq-home">
		<view class="cmdq-home-header">
			<view class="cmdq-home-header--left" @click="sendExpressDelivery('ed')" >
				<image
					src="@/static/home/send.png"
					mode="widthFix"
				/>
				<text>寄快递</text>
				<u-icon name="arrow-right"></u-icon>
			</view>
			<view class="cmdq-home-header--right" >
				<view class="header--right-top" @click="sendExpressDelivery('bulk')" >
					<image
						src="@/static/home/batch.svg"
						mode="widthFix"
					/>
					<text>批量寄件</text>
					<u-icon name="arrow-right"></u-icon>
				</view>
				<view class="header--right-bottom" @click="sendExpressDelivery('big')" >
					<image
						src="@/static/home/big.svg"
						mode="widthFix"
					/>
					<text>寄大件</text>
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
		</view>
		<view class="cmdq-home-box">
			<view class="cmdq-home-box-empty">
				<image src="@/static/common/empty.png" class="box-empty--pic" mode="widthFix"></image>
			</view>
			<text class="cmdq-home-box-empty--text">暂无物流信息</text>
			<button class="send-express-btn" @click="sendExpressDelivery('ed')">去寄件</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list1: [{
						name: '单件发货',
					}, {
						name: '批量发货'
				}],
				
				checkUserList: [],
				      importUserId: [],
				      goodsName: '',
				      options: [
				        {
				          label: '灯具',
				          value: '灯具',
				        }
				      ],
				show: false,
				columns: [
					[]
				],
				file: '请选择',
				length: 1,
				width: 1,
				height: 1,
				isLogin: true,
				xieyi: 'null',
				weight: 1,
				noticeList: ['加盟代理请联系：zs9527gblw', '使用途中出现任何问题请联系客服'],
				seller: [],
				query: [],
				reason: '',
				logList: [],
				uid: 0
			}
		},
		onLoad(options) {
			var that = this;
			that.isLogin = that.$us.checkLogin();
			if (that.isLogin) {
				this.uid = options.uid || 0;
				uni.showShareMenu({
					withShareTicket: true,
					menus: ["shareAppMessage", "shareTimeline"]
				})
				
				that.$http.get('product/list', {
					companyId: that.$us.getCompanyId(),
					pageNo: 1,
					pageSize: 2000
				}, function(res) {
					console.info(res)
					if (res.code == 'success') {
						// that.columns = 
					} 
				
					
				})
				
				
			}
			// console.log('是否登陆', that.isLogin)
		},
		onShow() {
			let that = this;
			that.isLogin = that.$us.checkLogin();
		},
		methods: {
			/**
			 * 发送快递信息
			 * 
			 * 此函数用于根据提供的快递类型发送快递
			 * 它主要通过打印快递类型来模拟发送过程
			 * 
			 * @param {string} type - 快递的类型，例如"标准"、"加急"
			 * 
			 * @returns {undefined} 不返回任何值
			 */
			sendExpressDelivery(type){
					// 打印快递类型，用于模拟发送过程
				console.log(type);
				if(this.isLogin){
					uni.navigateTo({
						url: `/cmhqPage/sendExpress/sendExpress?type=${type}`
					})
				}else{
					uni.navigateTo({
						url: `/cmhqPage/login/login`
					})
				}
			}
		},
		onShareAppMessage(res) {
			let that = this;
			var title = '这里寄快递超便宜,5块钱起寄全国,赶紧收藏起来';
			let imageUrl = '/static/share.jpg';
			if (res.from === 'button') {
				//这块需要传参，不然链接地址进去获取不到数据
				return {
					title: title,
					path: '/pages/index/index?uid=' + that.$us.getId(),
					imageUrl: imageUrl
				};
			}
			if (res.from === 'menu') {
				return {
					title: title,
					path: '/pages/index/index' + that.$us.getId(),
					imageUrl: imageUrl
				};
			}
		},
		// 分享到朋友圈
		onShareTimeline() {
			let imageUrl = '/static/share.jpg';
			return {
				title: title,
				path: '/pages/index/index' + that.$us.getId(),
				imageUrl: imageUrl
			};
		}
	}
</script>

<style lang="scss" scoped>
.cmdq-home{
	width: 100%;
	// font-family: PingFang SC,Microsoft Yahei,Helvetica Neue,Helvetica,Tahoma,sans-serif;
	.cmdq-home-header{
		display: flex;
		margin: 24rpx;
		background-color: #fff;
		border-radius: 16rpx;
		height: 360rpx;
		padding: 24rpx;
		font-size: 32rpx;
		.cmdq-home-header--left{
			flex: 1;
			display: flex;
			align-items: center;
			justify-content: center;
			background: linear-gradient(180deg,#fff9f9,#75b2f8);
			// background: url('../../static/home/send.png') no-repeat center;
			// background-size: 100% 100%;
			border-radius: 16rpx;
			margin-right: 24rpx;
			cursor: pointer;
			// color: #fff;
			font-weight: bold;
		}
		.cmdq-home-header--right{
			flex: 1;
			display: flex;
			flex-direction: column;
			.header--right-top{
				flex: 1;
				display: flex;
				align-items: center;
				justify-content: center;
				margin-bottom: 24rpx;
				border-radius: 16rpx;
				background: linear-gradient(270deg,#eadef9,#f7f5fb);
				cursor: pointer;
			}
			.header--right-bottom{
				flex: 1;
				display: flex;
				align-items: center;
				justify-content: center;
				border-radius: 16rpx;
				background: linear-gradient(270deg,#e0edf5,#f4fbfe);
				cursor: pointer;
			}
		}
		text{
			margin-right: 8rpx;
		}
		image{
			width: 48rpx;
			height: 48rpx;
			margin-right: 16rpx;
		}
	}
	.cmdq-home-box{
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		padding-top: 180rpx;
		.cmdq-home-box-empty{
			margin-bottom: 32rpx;
			.box-empty--pic{
				width: 240rpx;
			}
		}
		.cmdq-home-box-empty--text{
			font-size: 24rpx;
			margin-bottom: 48rpx;
			color: #999;
		}
		.is-hover{
			width: 240rpx;
		}
		.send-express-btn{
			color:#ffffff;
			background-color:#e69b3f;
			border:2rpx solid #e69b3f;
			width:240rpx;
			border-radius: 45rpx
		}
	}
}
</style>
